package com.bryantkobe.myspringcode.exception;

import java.io.Serial;

/**
 * @description: 业务规则异常
 * @author: alienwarezzl
 * @date: 2025/9/22
 */
public final class BusinessRuleException extends BusinessException implements BusinessExceptionType{
    @Serial
    private static final long serialVersionUID = 1L;

    private final String ruleCode;

    public BusinessRuleException(String ruleCode, String message) {
        super("BUSINESS_RULE_VIOLATION", message);
        this.ruleCode = ruleCode;
        withParam("ruleCode", ruleCode);
    }

    @Override
    public String getCategory() {
        return "BUSINESS_RULE";
    }

    public String getRuleCode() {
        return ruleCode;
    }
}
